<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>功能测试</title>
  <link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<div class="layui-tab layui-tab-card" lay-allowclose="true">
  <ul class="layui-tab-title">
    <li class="layui-this">Excel版本1</li>
    <li>Form-Test</li>
    <li>Excel版本2</li>
    <li>Test4</li>
  </ul>
  <div class="layui-tab-content" style="height: 500px;">
    <div class="layui-tab-item layui-show">
    	<blockquote class="layui-elem-quote layui-quote-nm"  style="margin-top: 5px;">
		  <div id="message">message:</div>
		  <br>
		</blockquote>
		 <br/>
    	<input type="file" name="file" id="uploadExcel" lay-type="file"  lay-ext="xls|xlsx" class="layui-upload-file" lay-title="上传Excel"> 
    	<button class="layui-btn layui-btn-normal layui-btn-radius" id="downLoadExcel">下载Excel</button>
    </div>
    <div class="layui-tab-item">
	    	<form  class="layui-form" action="/excel/index/uploadExcel" enctype="multipart/form-data" method="post">  
		        <div id="newUpload1">  
		            <input type="file" name="file">   
		        </div>  
	        	<input type="submit" class="layui-btn" value="上传" >  
		    </form> 
		    <br/><br/><br/>
		    <form class="layui-form" action="">
			  <div class="layui-form-item">
			    <label class="layui-form-label">验证必填项</label>
			    <div class="layui-input-block">
			      <input type="text" name="username" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
			    </div>
			  </div>
		  
		    <div class="layui-inline">
		      <label class="layui-form-label">验证数字</label>
		      <div class="layui-input-inline">
		        <input type="number" name="number" lay-verify="number" autocomplete="off" class="layui-input">
		      </div>
		    </div>
		    <div class="layui-form-item">
		    <button class="layui-btn" lay-submit="" lay-filter="demo2">跳转式提交</button>
		  </div>
		</form>
    </div>
    <div class="layui-tab-item">
    	<blockquote class="layui-elem-quote layui-quote-nm"  style="margin-top: 5px;">
		  <button class="layui-btn layui-btn-normal layui-btn-radius" id="passDownLoadExcelTemplate">下载ExcelTemplate</button>
		  <button class="layui-btn layui-btn-normal layui-btn-radius" id="passDownLoadExcelData">下载ExcelData</button>
		  <br>
		</blockquote>
    
    </div>
    <div class="layui-tab-item">4</div>
  </div>
</div>     
<script src="jquery/jquery-3.1.1.js"></script>
<script src="layui/layui.js"></script>
<script>
$(document).ready(function(){
	$("#downLoadExcel").click(function(){
		var url = "/excel/index/downloadExcel"
	    location.href = url;
	});
	
	$("#passDownLoadExcelTemplate").click(function(){
		var url = "/excel/module/exportTemplate/?key="+"jjyjdr";
	    location.href = url;
	});
	
	$("#passDownLoadExcelData").click(function(){
		var url = "/excel/module/exportResult/jjyjdr"
	    location.href = url;
	});
	
});

layui.use('element', function(){
  var element = layui.element(); //Tab的切换功能，切换事件监听等，需要依赖element模块
  
});
layui.use('layer', function(){
	  var layer = layui.layer;
}); 
layui.use('upload', function(){
	  layui.upload({
	    url: '/excel/index/uploadExcel?type=1'
	    ,elem: '#uploadExcel' //指定原始元素，默认直接查找class="layui-upload-file"
	    ,method: 'post' //上传接口的http类型
	    ,success: function(res){
	    	var resultJson = eval(res);
	    	var txt = JSON.stringify(res);
	    	console.log("txt->>>"+txt);
		    layer.open({
		    	  title: '返回结果'
		    	  ,content: txt
		    });
		    $("#message").html(txt);
	    }
	  });
});

layui.use('form', function(){
	  var form = layui.form();
});


</script>
</body>
</html>